git and how can I use it?gitVersion control:
Tools ➤ Global Options ➤ Git/SVN.
Make sure the first box is ticked and “git.exe” (Windows) “usr/bin/git” (MacOS) is included in the first box.
git config --global user.email "myemail@email.com" git config --global user.name "My commit name"
## set your user name and email: usethis::use_git_config(user.name = "My commit name", user.email = "myemail@email.com")
usethis::create_github_token()
credentials::set_github_pat("YourPAT")
File ➤ New Project ➤ Version Control ➤ Git
.gitignore file.gitignore file specifies a pattern.git add .gitignore myfirstrepo.Rproj
git can do auto-complete for file names!git add and git commit (next step).git add .gitignore myfirstrepo.Rproj git commit -am "My first commit"
Commits always have a commit message.
git add .gitignore myfirstrepo.Rproj git commit -am "My first commit" git push
Congrats! You have done it! Now local and remote repositories are up to date!
Before you start working on the project the next time (either in terminal or within R Studio):
git pull
Pull, work some more, repeat.
git diff
First things first: You cannot break things.
Read the output!
I don’t really have time to get into this
Additional info (in the material folder):
Vuorre, M., & Curley, J. P. (2018). Curating Research Assets: A Tutorial on the Git Version Control System. Advances in Methods and Practices in Psychological Science, 1(2), 219–236.